import request from '@/config/request'
import lessonApi from './lesson'
import type { ChapterForm } from '@/config/forms'

export default {
    getLesson: (lessonId : number) => lessonApi.getItem(lessonId),
    getList: (lessonId : number) => request.get('/backend/lessons/' + lessonId + '/chapters'),
    getItem: (id : number) => request.get('/backend/lessons/chapters/' + id),
    create: (form : ChapterForm) => request.post('/backend/lessons/chapters/', form),
    update: (id : number, form : ChapterForm) => request.post('/backend/lessons/chapters/' + id, form),
    delete: (id : number) => request.delete('/backend/lessons/chapters/' + id),
    onself: (ids : number[], status: boolean) => request.post('/backend/lessons/chapters/onself', {ids, status}),
}